package com.platform.apex.cma.db;

import org.skife.jdbi.v2.IDBI;

import com.platform.apex.util.SQLMetadataConnector;


public class Grib2DataInfoManager {

    private static IDBI dbi;
    private static Grib2DataInfoDao grib2DataInfoDao;

    public static void init(SQLMetadataConnector connector) {
    	dbi = connector.getDBI();
        grib2DataInfoDao = dbi.onDemand(Grib2DataInfoDao.class);
    }

    public static long create(Grib2DataInfo grib2DataInfo) {
//        return grib2DataInfoDao.insert(grib2DataInfo);
	    try{
	    	return grib2DataInfoDao.insert(grib2DataInfo);
//	    	String sql = "INSERT INTO datavi_cma_wrf_fnl_data (id, attributeName, filePath, dateDayStr, dateHourStr, dateDayLong, dateHourLong, createTime, updateTime) VALUES ('0f16fdb0b17b4a5694bbb263ec47043e', 'a_Mass_Geopotential_height_Isobaric_surface_50000', '/test02_cma_grib2/cma/wrf_fnl/y_2017/m_1/d_1/a_Mass_Geopotential_height_Isobaric_surface_50000/h_00.json', '2017-02-01 16:00:00', '2017-02-01 12:00:00', 1485936223700, 1485921823700, 1515053030820, 1515053030820)";
//	        return grib2DataInfoDao.insertSql(sql);
	    	
	    } catch (Exception e) {
			e.printStackTrace();
		}
    	return 0;
    }

}
